/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HOME
 */
@Entity
@Table(name = "BANKS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Banks.findAll", query = "SELECT b FROM Banks b"),
    @NamedQuery(name = "Banks.findByBankId", query = "SELECT b FROM Banks b WHERE b.bankId = :bankId"),
    @NamedQuery(name = "Banks.findByBankName", query = "SELECT b FROM Banks b WHERE b.bankName = :bankName"),
    @NamedQuery(name = "Banks.findByBankHomepage", query = "SELECT b FROM Banks b WHERE b.bankHomepage = :bankHomepage")})
public class Banks implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    //@Basic(optional = false)
    //@NotNull
    @Column(name = "BANK_ID")
    private BigDecimal bankId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 256)
    @Column(name = "BANK_NAME")
    private String bankName;
    @Size(max = 1024)
    @Column(name = "BANK_HOMEPAGE")
    private String bankHomepage;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bankId")
    private Collection<BanksInRegions> banksInRegionsCollection;

    public Banks() {
    }

    public Banks(BigDecimal bankId) {
        this.bankId = bankId;
    }

    public Banks(BigDecimal bankId, String bankName) {
        this.bankId = bankId;
        this.bankName = bankName;
    }

    public BigDecimal getBankId() {
        return bankId;
    }

    public void setBankId(BigDecimal bankId) {
        this.bankId = bankId;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankHomepage() {
        return bankHomepage;
    }

    public void setBankHomepage(String bankHomepage) {
        this.bankHomepage = bankHomepage;
    }

    @XmlTransient
    public Collection<BanksInRegions> getBanksInRegionsCollection() {
        return banksInRegionsCollection;
    }

    public void setBanksInRegionsCollection(Collection<BanksInRegions> banksInRegionsCollection) {
        this.banksInRegionsCollection = banksInRegionsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bankId != null ? bankId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Banks)) {
            return false;
        }
        Banks other = (Banks) object;
        if ((this.bankId == null && other.bankId != null) || (this.bankId != null && !this.bankId.equals(other.bankId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return bankName;
    }
    
}
